package com.zhiyou100;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.Test;

public class FormatDate {

	
	public String formatDate() {
		Date date = new Date();
//		System.out.println("当前电脑时间:"+date);
		String pattern = "yyyy-MM-dd HH:mm:ss";
		SimpleDateFormat sdf = new SimpleDateFormat(pattern); 
		String format = sdf.format(date);
//		System.out.println("转换格式后的当前日期时间:"+format);
		return format;
		
	}

}
